#include "config.h"
#include <stdio.h>
#include <stdlib.h>

int proc_count;
static int min_priority, max_priority, max_time;

int read_config() {
  FILE *fd = fopen("config", "r");
  return fscanf(fd, "%d\n%d\n%d\n%d", &proc_count, &min_priority, &max_priority,
                &max_time);
}

static int get_rand(int min, int max) { return rand() % (max - min + 1) + min; }

int get_rand_priority() { return get_rand(min_priority, max_priority); }

int get_rand_time() { return get_rand(1, max_time); }

int get_rand_time_slice(int need_time) { return get_rand(1, need_time); }